//////////////////////////////////////////////////////////////////////
//
// File: ButtonsScreen.java
//
// Copyright (c) 2005 TiVo Inc.
//
//////////////////////////////////////////////////////////////////////

package com.tivo.hme.samples.bananas;

import com.tivo.hme.bananas.BApplicationPlus;
import com.tivo.hme.bananas.BButtonPlus;
import com.tivo.hme.bananas.IBananasPlus;
import com.tivo.hme.bananas.layout.Layout;
import com.tivo.hme.bananas.layout.LayoutManager;

/**
 * A Screen to demonstrate the different look and feels of the standard Bananas
 * button
 *
 * @author Carl Haynes
 */
public class ButtonsScreen extends BananasSampleScreen
{   
    /**
     * Constructor
     */
    public ButtonsScreen(BApplicationPlus app)
    {
        super(app);
        
        
        //
        // a standard button with the highlights on the outside
        //
        
        LayoutManager lm = new LayoutManager(getNormal());
        Layout safeTitle = lm.safeTitle(this);
        Layout layout = safeTitle;

        layout = lm.relativeY(layout, true);
        layout = lm.valign(layout, A_TOP+20);
        Layout buttonLayout = lm.width(layout, 300);
        
        layout = lm.halign(buttonLayout, A_CENTER);
        
        boolean highlights_inside = false;
        BButtonPlus stdrdButton = new BButtonPlus(getNormal(), layout);
        stdrdButton.setBarAndArrows(BAR_DEFAULT, BAR_DEFAULT, "pop", null, null, H_DOWN, highlights_inside);
        stdrdButton.setValue("A Standard Button");
        setFocusDefault(stdrdButton);
        
        
        //
        // A standard button with the highlights on the inside
        //
        
        highlights_inside = true;
        BButtonPlus outsideButton = new BButtonPlus(getNormal(), layout);
        outsideButton.setBarAndArrows(BAR_DEFAULT, BAR_DEFAULT, "pop", null, H_UP, H_DOWN, highlights_inside);
        outsideButton.setValue("Highlights on the Inside");
        
        
        // 
        // a disabled looking button
        //
        
        BButtonPlus disabledButton = new BButtonPlus(getNormal(), layout);
        disabledButton.setBarAndArrows(BAR_DEFAULT, BAR_DEFAULT, IBananasPlus.FLAG_DISABLED_NOFOCUS, 
        		"pop", null, H_UP, H_DOWN, true);
        disabledButton.setValue("Disabled Bar");

        
        //
        // a left hanging button
        //

        layout = lm.halign(buttonLayout, A_LEFT);
        
        BButtonPlus leftButton = new BButtonPlus(getNormal(), layout);
        leftButton.setBarAndArrows(BAR_HANG, BAR_DEFAULT, "pop", null, H_UP, H_DOWN, true);
        leftButton.setValue("A Left Hanging Button");
        
        // 
        // a right hanging button
        //

        layout = lm.halign(buttonLayout, A_RIGHT);
        
        BButtonPlus rightButton = new BButtonPlus(getNormal(), layout);
        rightButton.setBarAndArrows(BAR_DEFAULT, BAR_HANG, "pop", null, H_UP, null, true);
        rightButton.setValue("A Right Hanging Button");

    }
    
    /**
     * Title of the screen
     */
    public String toString() 
    {
        return "BButton";
    }
}
